package cn.com.bluemoon.daps.model.vo;

import cn.com.bluemoon.daps.common.domain.UserPermissionApi;
import cn.com.bluemoon.daps.model.entity.DapDataModelTableForeignKey;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

@Data
@Accessors
public class ForeignKeyVo implements UserPermissionApi {

    @Valid
    @ApiModelProperty(value = "外键列表")
    @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
    public List<DapDataModelTableForeignKey> keyList;

    @ApiModelProperty("模型id")
    @NotNull(message = "模型id不能为空")
    public String modelId;

    @Override
    public Serializable getUserPermissionKeyValue() {
        return modelId;
    }
}
